package com.itheima.Demo;

//使用spring-test注解测试
import com.itheima.domain.User;
import com.itheima.service.UserService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import java.util.List;

//不要忘记classpath
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("classpath:spring.xml")
public class TestDemo1 {

    //@Autowired默认按类型装配
    @Autowired
    private UserService userService;

    @Test
    public void test1(){
        List<User> all = userService.findAll();
        System.out.println(all);
    }


}
